package org.dynamicallyacquired.domain;

import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.*;
import org.springframework.data.redis.serializer.RedisSerializer;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.HashSet;

import java.util.Set;

@Data
@AllArgsConstructor
@NoArgsConstructor
@EqualsAndHashCode(callSuper = false)
@ToString
@TableName("mk_info")
@JsonIgnoreProperties(ignoreUnknown = true)
public class AndroidInfo extends Model<AndroidInfo> {

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;
    @NotBlank
    private String packageName;
    @NotBlank
    private String url;
    @NotBlank
    private String appName;
    private String iconName;
    private String apkPath;
    private String fullPath;
    private String buildTime;
    private String uuid;
    private String downloadUrl;
    private String appsflyer_token;
    private String adjust_token;
    @NotBlank
    private String code;
    private String iconUrl;
    @TableField(exist = false)
    private Set<DataPoint> dataPoints = new HashSet<>();
    private int isPackage;
    private String channel;

    public AndroidInfo(String packageName, String url, String appName, String iconName) {
        this.packageName = packageName;
        this.url = url;
        this.appName = appName;
        this.iconName = iconName;
    }

    @Override
    protected Serializable pkVal() {
        return this.id;
    }
}
